package com.sunny.ynhz.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
//import com.nostra13.universalimageloader.core.ImageLoader;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.HistoryPatrolBean;

import java.util.LinkedList;

/**
 * Created by luao on 2017/6/7.
 */

public class NewBaseAdapter extends BaseAdapter {

    private Context mContext;
    private LinkedList<HistoryPatrolBean.DataBean.RowsBean> mItemLists;

    public NewBaseAdapter(Context mContext) {
        this.mContext = mContext;
    }

//    @Override
//    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//        View view = LayoutInflater.from(mContext).inflate(R.layout.item_base_news,null);
//        ViewGroup.LayoutParams layoutParams =view.getLayoutParams();
//        layoutParams.width= DisplayUtil.getScreenWidth(mContext);
//        view.setLayoutParams(layoutParams);
//        MyHolder myHolder = new MyHolder(view);
//        return myHolder;
//    }
//
//    @Override
//    public void onBindViewHolder(MyHolder holder, int position) {
//
//    }
//
//    @Override
//    public int getItemCount() {
//        return 6;
//    }

    @Override
    public int getCount() {
        return 7;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        View view1 = LayoutInflater.from(mContext).inflate(R.layout.item_base_news, null);
        ImageView imageView = (ImageView) view1.findViewById(R.id.img_new);
        Glide.with(mContext).load(R.mipmap.h1).into(imageView);
//        ImageLoader.getInstance().displayImage("drawable://" + R.mipmap.h1, imageView, ImageLoadUtils.MyDisplayImageOptions());
        TextView tv_title = (TextView) view1.findViewById(R.id.tv_title);
        TextView tv_content = (TextView) view1.findViewById(R.id.tv_content);
        String title="";
        String content="";
        if(position==0){
            title="我市召开农村生活污水治理会议";
            content="我市召开农村污水治理会议";

        }
        else if(position==1){
            title="今年暴雨频繁集中我市召开加强汛期灾害防范工作会议";
            content="今年暴雨频繁集中我市召开加强汛期灾害防范工作会议";
        }
        else  if(position==2){
            title="广州市生态文明城市建设试点迎考";
            content="广州市生态文明城市建设试点迎考，全面完成71项建设任务 25项指标全部达成";

        }
        else  if(position==3){
            title="市河长办组织召开沙河涌流域全面落实河长制工作动员大会";
            content="市河长办组织召开沙河涌流域全面落实河长制工作动员大会";

        }
        else  if(position==4){
            title="市政协李瑾副主席调研荔湾区、番禺区9条河涌水环境治理工作会议";
            content="市政协李瑾副主席调研荔湾区、番禺区9条河涌水环境治理工作会议";

        }
        else  if(position==5){
            title="市河长办对450名河长进行培训";
            content="市河长办对450名河长进行培训";

        }
        else  if(position==6){
            title="市人大组织调研流溪河流域水环境治理工作";
            content="市人大组织调研流溪河流域水环境治理工作";

        }
        tv_title.setText(title);
        tv_content.setText(content);
        return view1;
    }

}

